3.6 \(\int \csc ^2(x) (a \cos (x)+b \sin (x)) \, dx\)

Optimal. Leaf size=12 \[ -a \csc (x)-b \tanh ^{-1}(\cos (x)) \]

[Out]

-b*arctanh(cos(x))-a*csc(x)

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 12, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3089, 3770, 2606, 8} \[ -a \csc (x)-b \tanh ^{-1}(\cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[Csc[x]^2*(a*Cos[x] + b*Sin[x]),x]

[Out]

-(b*ArcTanh[Cos[x]]) - a*Csc[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2606

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 3089

Int[sin[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[sin[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int \csc ^2(x) (a \cos (x)+b \sin (x)) \, dx &=\int (b \csc (x)+a \cot (x) \csc (x)) \, dx\\ &=a \int \cot (x) \csc (x) \, dx+b \int \csc (x) \, dx\\ &=-b \tanh ^{-1}(\cos (x))-a \operatorname {Subst}(\int 1 \, dx,x,\csc (x))\\ &=-b \tanh ^{-1}(\cos (x))-a \csc (x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 0.01, size = 25, normalized size = 2.08 \[ -a \csc (x)+b \log \left (\sin \left (\frac {x}{2}\right )\right )-b \log \left (\cos \left (\frac {x}{2}\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[x]^2*(a*Cos[x] + b*Sin[x]),x]

[Out]

-(a*Csc[x]) - b*Log[Cos[x/2]] + b*Log[Sin[x/2]]

________________________________________________________________________________________

fricas [B]  time = 0.46, size = 33, normalized size = 2.75 \[ -\frac {b \log \left (\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right ) \sin \relax (x) - b \log \left (-\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right ) \sin \relax (x) + 2 \, a}{2 \, \sin \relax (x)} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2*(a*cos(x)+b*sin(x)),x, algorithm="fricas")

[Out]

-1/2*(b*log(1/2*cos(x) + 1/2)*sin(x) - b*log(-1/2*cos(x) + 1/2)*sin(x) + 2*a)/sin(x)

________________________________________________________________________________________

giac [B]  time = 0.20, size = 33, normalized size = 2.75 \[ b \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right ) - \frac {1}{2} \, a \tan \left (\frac {1}{2} \, x\right ) - \frac {2 \, b \tan \left (\frac {1}{2} \, x\right ) + a}{2 \, \tan \left (\frac {1}{2} \, x\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2*(a*cos(x)+b*sin(x)),x, algorithm="giac")

[Out]

b*log(abs(tan(1/2*x))) - 1/2*a*tan(1/2*x) - 1/2*(2*b*tan(1/2*x) + a)/tan(1/2*x)

________________________________________________________________________________________

maple [A]  time = 0.50, size = 19, normalized size = 1.58 \[ -\frac {a}{\sin \relax (x )}+b \ln \left (-\cot \relax (x )+\csc \relax (x )\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(x)^2*(a*cos(x)+b*sin(x)),x)

[Out]

-a/sin(x)+b*ln(-cot(x)+csc(x))

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 24, normalized size = 2.00 \[ -\frac {1}{2} \, b {\left (\log \left (\cos \relax (x) + 1\right ) - \log \left (\cos \relax (x) - 1\right )\right )} - \frac {a}{\sin \relax (x)} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)^2*(a*cos(x)+b*sin(x)),x, algorithm="maxima")

[Out]

-1/2*b*(log(cos(x) + 1) - log(cos(x) - 1)) - a/sin(x)

________________________________________________________________________________________

mupad [B]  time = 0.40, size = 24, normalized size = 2.00 \[ b\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )-\frac {a}{2\,\mathrm {tan}\left (\frac {x}{2}\right )}-\frac {a\,\mathrm {tan}\left (\frac {x}{2}\right )}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a*cos(x) + b*sin(x))/sin(x)^2,x)

[Out]

b*log(tan(x/2)) - a/(2*tan(x/2)) - (a*tan(x/2))/2

________________________________________________________________________________________

sympy [A]  time = 1.83, size = 24, normalized size = 2.00 \[ - \frac {a}{\sin {\relax (x )}} + \frac {b \log {\left (\cos {\relax (x )} - 1 \right )}}{2} - \frac {b \log {\left (\cos {\relax (x )} + 1 \right )}}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)**2*(a*cos(x)+b*sin(x)),x)

[Out]

-a/sin(x) + b*log(cos(x) - 1)/2 - b*log(cos(x) + 1)/2

________________________________________________________________________________________